package com.zxtech.zzm.zxmonitorsu.core

import android.app.Application
import android.content.Context
import android.content.Intent
import android.util.Log
import com.zxtech.zzm.core.`interface`.CoreInterface
import com.zxtech.zzm.core.util.CommonUtil
import com.zxtech.zzm.core.util.DeviceUtil
import com.zxtech.zzm.zxmonitorsocket.ZXMonitorSocketService

class ZXMonitorApplication : Application(), CoreInterface {
  companion object {
    private var context: Context? = null
    fun getContext(): Context {
      return context!!
    }
  }

  override fun onCreate() {
    super.onCreate()
    init()
  }

  fun init(){
    DeviceUtil.coreInterface = this
    context = applicationContext
    CommonUtil.init(context!!)
    DeviceUtil.initTerminalID()
  }

  override fun onTerminalIDInited() {
    Log.e("zzm debug", "onTerminalIDInited ID :" + DeviceUtil.ID)
    startService(Intent(this, ZXMonitorSocketService::class.java))
  }
}